﻿package config;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

public class LoadFile {
	
	public String Load(String url) {
		String fileStr = "";
		String fileName =url;
		File file = new File(fileName);
		
		long len = file.length();
		byte[] bytes = new byte[(int) len];
		
		BufferedInputStream bufferedInputStream;
		try {
			bufferedInputStream = new BufferedInputStream(new FileInputStream(file));
			int r = bufferedInputStream.read(bytes);
			if (r != len) {
				throw new IOException("读取文件不正确");
			}
			bufferedInputStream.close();
			// System.out.println("FTP方式读取文件内容："+new String(bytes,"utf-8"));
			fileStr = new String(bytes, "utf-8");
			// System.out.println(fileStr);
			return fileStr;
		} catch (Exception e) {
			
		}
		return "";
	}
}
